/**
 * JAVACC DEMO 1.0
 * @copy right dwusoft company All rights reserved. 
 * @Package com.apache.order.util  
 */
package com.apache.info.util;

import java.util.Locale;

import org.springframework.context.NoSuchMessageException;

import com.apache.cache.util.Validator;
import com.apache.database.constant.SpringContextLoader;

/**
 * description:  
 * @author dwusoft 创建时间：2015-9-23  
 * @Copyright(c)2014:北京--软件技术有限公司
 */
public class MessageUtil {

	public static String getMessage(String key, String[] params, String defaultMessage) {
		String msg = "";
		try {
			msg = SpringContextLoader.getContext().getMessage(key, params, Locale.CHINA);
			msg = Validator.getDefaultStr(msg, defaultMessage);
		} catch (NoSuchMessageException e) {
			msg = defaultMessage;
		}
		return Validator.getDefaultStr(msg, defaultMessage);
	}
}
